<div class="easyui-layout"data-options="fit:true">
    <div style="height:76px;border-bottom: 1px solid #95B8E7;" data-options="region:'north',border:false" title="潜在学员录入">
    	<form class="search-from">
			<input class="easyui-textbox" data-options="label:'搜索内容：'" style="width:200px">
    		<select id="selcet_type" class="easyui-combobox" name="dept" style="width:200px;">
			    <option value="aa">全局</option>
			    <option>姓名</option>
			    <option>电话</option>
			    <option>QQ</option>
			    <option>微信</option>
			</select>
			<a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">检索</a>
		</form>
    </div>
    <div id="recruit_center"data-options="region:'center',border:false">
    	<table id="entering_student_list">
		    <div id="pp" class="easyui-pagination" style="background:#efefef;border:1px solid #ccc;"
			        data-options="total:2000,pageSize:10">
			</div>
    	</table>
    </div>
</div>
<style>
	.search-from {
		float: right;
		padding: 10px 1px;
	}
</style>
<script type="text/javascript">
	$(function(){		
		var tab = $("#entering_student_list");
		var center = $("#recruit_center");
		tab.datagrid({
			fit : true,
			fitColumns : true,
			border:false,
			toolbar: [{
				iconCls : 'icon-add',
				text : "录入学员",
				handler : function() {
					 createForm(0);
				}},{
				iconCls : 'icon-add',
				text : "分配咨询师",
				handler : function() {
					 createAllocation();
				}
			}],
		    columns:[[
		        {field:'studentId',title:'编号',width:20,align:'center'},
		        {field:'studentName',title:'姓名',width:30,align:'center'},
		        {field:'studentSex',title:'性别',width:20,align:'center'},
		        {field:'studentPhone',title:'电话',width:40,align:'center'},
		        {field:'studentQQ',title:'QQ',width:40,align:'center'},
		        {field:'studentWeixin',title:'微信',width:40,align:'center'},
		        {field:'studentParent',title:'父母',width:20,align:'center'},
		        {field:'StudentParentPhone',title:'父母电话',width:40,align:'center'},
		        {field:'studentSource',title:'来源',width:40,align:'center'},
		        {field:'studentLevel',title:'兴趣等级',width:30,align:'center'},
		        {field:'enteringMan',title:'录入人',width:20,align:'center'},
		        {field:'enteringDate',title:'录入时间',width:40,align:'center'},
		        {field : 'doing',title:'操作',width:50,align:'center',
					formatter : function(value, row, index) {
						var btns = [];
						btns.push('<a data-id="' + value
								+ '" class="ctr ctr-edit">编辑</a>');
						btns.push('<a data-id="' + value
								+ '" class="ctr ctr-delete">删除</a>');
						return btns.join("");
					}
				}
		    ]],
		    data:[{
			    	studentId:'value11', 		 
					studentName:'value12',
					studentSex:'value12',
					studentPhone:'value12',
					studentQQ:'value12',
					studentWeixin:'value12',
					studentParent:'value12',
					StudentParentPhone:'value12',
					studentSource:'value12',
					studentLevel:'value12',
					enteringMan:'value12',
					enteringDate:'value12'	
				},
				{
					studentId:'value11', 
					studentName:'value12',
					studentSex:'value12',
					studentPhone:'value12',
					studentQQ:'value12',
					studentWeixin:'value12',
					studentParent:'value12',
					StudentParentPhone:'value12',
					studentSource:'value12',
					studentLevel:'value12',
					enteringMan:'value12',
					enteringDate:'value12'	
				}]    
		});
		center.on('click', "a.ctr-edit", function() {// 编辑按钮事件
			createForm.call(this, this.dataset.id)
		}).on('click', "a.ctr-delete", function() {// 删除按钮事件
			//数据操作成功后，对列表数据，进行刷新
			tab.datagrid("reload");
		});
		function createForm(id) {
			$("<div/>").dialog({
				title : (id ? "修改" : "增加") + "学员",
				height : 500,
				width : 400,
				href : '/recruit/entering/form',
				queryParams : {
					id : id
				},
				modal : true,
				onClose : function() {
					$(this).dialog("destroy");
				},
				buttons : [ {
					iconCls : 'icon-save',
					text : '保存',
					handler : function() {

					}
				} ]
			});
		}
		function createAllocation() {
			$("<div/>").dialog({
				title :"分配学员",
				height : 500,
				width : 600,
				href : '/recruit/entering/allocationform',
				modal : true,
				onClose : function() {
					$(this).dialog("destroy");
				},
				buttons : [ {
					iconCls : 'icon-save',
					text : '保存',
					handler : function() {

					}
				} ]
			});
		}
	});
</script>